package cn.com.blueInfo.bpm.system.enums;

import cn.com.blueInfo.bpm.common.enums.BaseEnum;
import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 资源类型
 * @author suxch
 * @since 2025/8/28 22:23
 */
@Getter
@AllArgsConstructor
public enum ResourceType implements BaseEnum<Integer> {

    /** 资源类型-菜单 */
    MENU(1, "菜单"),
    /** 资源类型-按钮 */
    BUTTON(2, "按钮"),
    /** 资源类型-字段 */
    FIELD(3, "字段");

    @EnumValue
    private final Integer code;

    @JsonValue
    private final String desc;

    public static ResourceType getByCode(Integer code) {
        return BaseEnum.getByCode(ResourceType.class, code);
    }

    @JsonCreator
    public static ResourceType getByName(String name) {
        return BaseEnum.getByName(name, ResourceType.class);
    }

}
